<html>
<head><meta charset="utf-8"><title>Examples for ast::* items · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Examples.20for.20ast.3A.3A*.20items.html">Examples for ast::* items</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224925351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Examples%20for%20ast%3A%3A%2A%20items/near/224925351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Przemysław Horban <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Examples.20for.20ast.3A.3A*.20items.html#224925351">(Feb 02 2021 at 19:44)</a>:</h4>
<p>Hello, I've been trying to contribute to RA recently and the problem that I have right now is that it's hard for me to match ast::* elements to what they are parsed from. For example I look at ast::IdentPat and I'm not sure what it represents.</p>
<p>Is there some sort of mapping for this and the text?</p>



<a name="224925454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Examples%20for%20ast%3A%3A%2A%20items/near/224925454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Examples.20for.20ast.3A.3A*.20items.html#224925454">(Feb 02 2021 at 19:45)</a>:</h4>
<p>hmm, we used to have this as part of the docs</p>



<a name="224925597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Examples%20for%20ast%3A%3A%2A%20items/near/224925597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Przemysław Horban <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Examples.20for.20ast.3A.3A*.20items.html#224925597">(Feb 02 2021 at 19:46)</a>:</h4>
<p>I don't need nice docs... just any hacky way to quickly figure it out ;)</p>



<a name="224925876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Examples%20for%20ast%3A%3A%2A%20items/near/224925876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Examples.20for.20ast.3A.3A*.20items.html#224925876">(Feb 02 2021 at 19:48)</a>:</h4>
<p>There's a "show syntax tree" command in Code</p>



<a name="224926249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Examples%20for%20ast%3A%3A%2A%20items/near/224926249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Przemysław Horban <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Examples.20for.20ast.3A.3A*.20items.html#224926249">(Feb 02 2021 at 19:50)</a>:</h4>
<p>Ok, I tried it and it's very helpful. Thank you!</p>



<a name="224931113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Examples%20for%20ast%3A%3A%2A%20items/near/224931113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Examples.20for.20ast.3A.3A*.20items.html#224931113">(Feb 02 2021 at 20:24)</a>:</h4>
<p>Looking at <a href="https://github.com/rust-analyzer/ungrammar/blob/master/rust.ungram">https://github.com/rust-analyzer/ungrammar/blob/master/rust.ungram</a> also helps in understanding the AST-structure as thats what RA's ast is based on</p>



<a name="224938013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Examples%20for%20ast%3A%3A%2A%20items/near/224938013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Przemysław Horban <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Examples.20for.20ast.3A.3A*.20items.html#224938013">(Feb 02 2021 at 21:18)</a>:</h4>
<p>IdentPat =<br>
  Attr* 'ref'? 'mut'? Name ('@' Pat)?</p>
<p>Nice! Between viewing the syntax treen in vscode and this grammar I can figure out all the terms. Thank you!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>